
import re
import os
import sys

def ruler(stream):
    """
    o: generate ruler for data picking
    ----|----1----|----2----|----3----|----4-...
    import pepe.dmp.pickdata as pd
    print pd.ruler()
    """
    out_s = ''
    for i in (1,2,3,4,5,6,7,8,9,'A'):
        out_s += '-'*4+'|'+'-'*4+str(i)
    for i in (1,2,3,4,5,6,7,8,9,'B'):
        out_s += '-'*4+'|'+'-'*4+str(i)
    for i in (1,2,3,4,5,6,7,8,9,'C'):
        out_s += '-'*4+'|'+'-'*4+str(i)
    for i in (1,2,3,4,5,6,7,8,9,'D'):
        out_s += '-'*4+'|'+'-'*4+str(i)
    for i in (1,2,3,4,5,6,7,8,9,'E'):
        out_s += '-'*4+'|'+'-'*4+str(i)
    out_s = re.sub(' ','', out_s)
    stream.write(out_s+'\n')
    return True

def main():
    ruler(sys.stdout)
    """
    f = open('ruler.tmp','w')
    ruler(f)
    #ruler(sys.stdout)
    f.close()
    os.system('notepad ruler.tmp')
    """

if __name__ == "__main__":
    main()
